package org.qpcr.community.device.entity;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import org.hswebframework.ezorm.rdb.mapping.annotation.ColumnType;
import org.hswebframework.ezorm.rdb.mapping.annotation.Comment;
import org.hswebframework.ezorm.rdb.mapping.annotation.DefaultValue;
import org.hswebframework.web.api.crud.entity.GenericEntity;
import org.hswebframework.web.api.crud.entity.RecordCreationEntity;
import org.hswebframework.web.api.crud.entity.RecordModifierEntity;
import org.hswebframework.web.crud.annotation.EnableEntityEvent;
import org.hswebframework.web.crud.generator.Generators;
import org.hswebframework.web.validator.CreateGroup;

import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;
import java.sql.JDBCType;


@Getter
@Setter
@Table(name = "biz_calibration_experimental_records")
@Comment("荧光校准实验记录表")
@EnableEntityEvent
public class CalibrationExperimentalRecordsEntity extends GenericEntity<String> implements RecordCreationEntity, RecordModifierEntity {

    @Override
    @GeneratedValue(generator = Generators.SNOW_FLAKE)
    @NotBlank(message = "ID不能为空", groups = CreateGroup.class)
    @Schema(description = "ID")
    public String getId() {
        return super.getId();
    }

    @Column(name = "receive_time")
    @DefaultValue(generator = Generators.CURRENT_TIME)
    @Schema(
            description = "时间"
            , accessMode = Schema.AccessMode.READ_ONLY
    )
    public Long receiveTime;

    @Column(name = "data_source", length = 64)
    @Schema(description = "数据源")
    private String dataSource;

    @Column(name = "device_name", length = 100)
    @Schema(description = "设备名称")
    private String deviceName;

    @Column(name = "name", length = 100)
    @Schema(description = "实验名称")
    private String name;

    @Column(name = "item", length = 100)
    @Schema(description = "检测项目")
    private String item;

    @Column(name = "item_code", length = 100)
    @Schema(description = "检测项目编号")
    private String itemCode;

    @Column(name = "temperature_name", length = 100)
    @Schema(description = "控温算法名称")
    private String temperatureControl;

    @Column(name = "temperature_code", length = 100)
    @Schema(description = "控温算法编号")
    private String temperatureCode;

    @Column(name = "seq_name", length = 100)
    @Schema(description = "序列名称")
    private String seqName;

    @Column(name = "seq_code", length = 100)
    @Schema(description = "序列编号")
    private String seqCode;

    @Column(name = "light_channel", length = 100)
    @Schema(description = "测光通道")
    private String lightChannel;

    @Column(name = "sample_number", length = 64)
    @Schema(description = "样本编号")
    private String sampleNumber;

    @Column(name = "reagent_number", length = 64)
    @Schema(description = "试剂编号")
    private String reagentNumber;

    @Column(name = "product_id", length = 64)
    @Schema(description = "产品编号")
    private String productId;

    @Column(name = "device_id", length = 64)
    @Schema(description = "设备编号")
    private String deviceId;

    @Column(name = "module_id", length = 64)
    @Schema(description = "模块id")
    private String moduleId;

    @Column(name = "module_code", length = 64)
    @Schema(description = "模块编号")
    private String moduleCode;

    @Column(name = "carrier", length = 64)
    @Schema(description = "载体信息")
    private String carrier;

    @Column(name = "sequence")
    @ColumnType(jdbcType = JDBCType.LONGVARCHAR)
    @Schema(description = "序列信息")
    private String sequence;


    @Column(name = "module_state")
    @ColumnType(jdbcType = JDBCType.LONGVARCHAR)
    @Schema(description = "模块状态")
    private String moduleState;

    @Column(name = "state", length = 64)
    @Schema(description = "状态")
    private String state;

    @Column(name = "type", length =1 )
    @Schema(description = "类型 0 正常实验记录  1调试实验记录")
    private Integer type;

    @Column(name = "result", length = 64)
    @Schema(description = "实验结果 0 阴性 1阳性 其他无效")
    private Integer result;

    @Column(name = "vic", precision = 8, scale = 2)
    @Schema(description = "VIC")
    private  Double vic;

    @Column(name = "cy5", precision = 8, scale = 2)
    @Schema(description = "Cy5")
    private Double cy5;

    @Column(name = "fam", precision = 8, scale = 2)
    @Schema(description = "FAM")
    private Double fam;

    @Column(name = "rox", precision = 8, scale = 2)
    @Schema(description = "ROX")
    private Double rox;

    @Column(name = "run_time", length = 64)
    @Schema(description = "运行时长")
    private String runTime;

    @Column(name = "item_up_status", length = 1)
    @Schema(description = "检测项修改状态")
    private Integer itemUpStatus;

    @Column(name = "seq_up_status", length = 1)
    @Schema(description = "序列修改状态")
    private Integer seqUpStatus;

    @Column(name = "light_up_status", length = 1)
    @Schema(description = "通道修改状态")
    private Integer lightUpStatus;

    @Column(name = "software_version", length = 60)
    @Schema(description = "软件版本号")
    private String softwareVersion;

    @Column(name = "module_version", length = 60)
    @Schema(description = "模块版本号")
    private String moduleVersion;

    @Column(name = "creator_id", updatable = false)
    @Schema(
        description = "创建者ID(只读)"
        , accessMode = Schema.AccessMode.READ_ONLY
    )
    private String creatorId;

    @Column(name = "creator_user_name", updatable = false)
    @Schema(
        description = "创建者账号(只读)"
        , accessMode = Schema.AccessMode.READ_ONLY
    )
    private String creatorUserName;

    @Column(name = "unit_id", updatable = false)
    @Schema(
        description = "单位ID(只读)"
        , accessMode = Schema.AccessMode.READ_ONLY
    )
    private String unitId;

    @Column(name = "creator_name", updatable = false)
    @Schema(
        description = "创建者名称(只读)"
        , accessMode = Schema.AccessMode.READ_ONLY
    )
    private String creatorName;

    @Column(name = "create_time", updatable = false)
    @DefaultValue(generator = Generators.CURRENT_TIME)
    @Schema(
        description = "创建时间(只读)"
        , accessMode = Schema.AccessMode.READ_ONLY
    )
    private Long createTime;

    @Column
    @DefaultValue(generator = Generators.CURRENT_TIME)
    @Schema(
        description = "修改时间"
        , accessMode = Schema.AccessMode.READ_ONLY
    )
    private Long modifyTime;

    @Column(length = 64)
    @Schema(
        description = "修改人ID"
        , accessMode = Schema.AccessMode.READ_ONLY
    )
    private String modifierId;

    @Column(length = 64)
    @Schema(
        description = "修改人名称"
        , accessMode = Schema.AccessMode.READ_ONLY
    )
    private String modifierName;

    @Column(length = 64,name = "message_id")
    @Schema(description = "消息ID")
    private String messageId;

    @Column(name = "fluorescence_calibration_param")
    @ColumnType(jdbcType = JDBCType.LONGVARCHAR)
    @Schema(description = "分析参数")
    private String fluorescenceCalibrationParam;
}
